package com.gxaedu.shiro.exception;

import com.gxaedu.shiro.dto.ResponseData;
import com.gxaedu.shiro.dto.ResultData;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author:Teacher黄
 * @date:Created at 2020/04/23
 */
@RestControllerAdvice
public class ShiroExceptionHandler {


    /**
     * 捕获没有权限的异常
     * @param e
     * @return
     */
    @ExceptionHandler(AuthorizationException.class)
    ResultData authorizationExceptionHandler(AuthorizationException e){
        return ResponseData.error(9527,"对不起!没有权限!");
    }


}
